<table cellpadding=0; border=0 style="width: 100%">
   <tr >
    <td valign=top style="width: 20%; text-align: left">
     <div class="perfil_menu">
      <UL>
       <li><a href="http://www.forsale.org/suser/utilizadores">Listar Utilizadores</a></li>
       <li><a href="http://www.forsale.org/suser/utilizadores/pesquisa">Pesquisa Simples</a></li>
       <li><a href="http://www.forsale.org/suser/utilizadores/pesquisa_avancada">Pesquisa Avançada</a></li>
      </UL>
     </div>
    </td>
    <td valign=top style="width: 100%; text-align: center">
     <div id="menu_area" style="text-align: center">
      Resultados da pesquisa a "<strong><?=$_GET['q'] ?></strong>"<br /><br />
      <form>
 	   <input type="text" name="q" id="q" size=30 value="<?=isset($_GET['q']) ? $_GET['q'] : "" ?>"/>
 	   <select name="opt">
  		<option <?=(isset($_GET['opt']) ? ($_GET['opt'] == 1 ? "selected" : "") : "selected") ?> value="1">Primeiro Nome</option>
  		<option <?=(isset($_GET['opt']) ? ($_GET['opt'] == 2 ? "selected" : "") : "")  ?> value="2">Ultimo Nome</option>
  		<option <?=(isset($_GET['opt']) ? ($_GET['opt'] == 3 ? "selected" : "") : "")  ?> value="3">E-mail</option>
  		<option <?=(isset($_GET['opt']) ? ($_GET['opt'] == 4 ? "selected" : "") : "")  ?> value="4">Data Registo</option>
  		<option <?=(isset($_GET['opt']) ? ($_GET['opt'] == 5 ? "selected" : "") : "")  ?> value="5">Contacto</option>
  		<option <?=(isset($_GET['opt']) ? ($_GET['opt'] == 6 ? "selected" : "") : "")  ?> value="6">Observacoes</option>
 	   </select>
 	   <input type="submit" value="Pesquisar" />
	  </form>
   	  <table>
       <caption></caption>
    	<thead>
     	 <tr>
       	  <th><a href="/suser/utilizadores/pesquisa_avancada?q=<?=$_GET['q'] ?>&opt=<?=$_GET['opt'] ?>&ord=<?=$m_ord == 1 ? 2 : 1 ?>&tipo=1&ind=1">ID</a></th>
      	  <th><a href="/suser/utilizadores/pesquisa_avancada?q=<?=$_GET['q'] ?>&opt=<?=$_GET['opt'] ?>&ord=<?=$m_ord == 1 ? 2 : 1 ?>&tipo=2&ind=1">Nome</a></th>
     	  <th><a href="/suser/utilizadores/pesquisa_avancada?q=<?=$_GET['q'] ?>&opt=<?=$_GET['opt'] ?>&ord=<?=$m_ord == 1 ? 2 : 1 ?>&tipo=3&ind=1">Data Registo</a></th>
      	  <th><a href="/suser/utilizadores/pesquisa_avancada?q=<?=$_GET['q'] ?>&opt=<?=$_GET['opt'] ?>&ord=<?=$m_ord == 1 ? 2 : 1?>&tipo=4&ind=1">email</a></th>
     	 </tr>
    	</thead>
    	<tbody>
     	<?
      	 if(isset($utilizadores[0]['email']))
       	 {
      		foreach($utilizadores as $user)
      		{
      			$output = "<TR>";
      			$output .= "<TD>" . $user['id'] . "</TD>";
      			$output .= "<TD>" . $user['primeiro_nome'] . "  " .  $user['ultimo_nome'] . "</TD>";
      			$output .= "<TD>" . $user['data_registo'] . "</TD>";
      			$output .= "<TD>" . $user['email'] . "</TD>";
      			echo $output;
      		}
      	}
      	?>
    	</tbody>
    	<tfoot>
    	</tfoot>
   	   </table>
   	  </div>
    </td>
   </tr>
  </table>